Update cost center

This request allows you to update a cost center in the dictionary.

Request syntax

POST https://b2b-api.go.yandex.ru/integration/2.0/cost_centers/update?id=<cost_center_id>

Request header

  • Authorization: Bearer <OAuth-token>
    OAuth access token. The steps to get a token are described in Getting started.
  • X-YaTaxi-Selected-Corp-Client-Id — client ID from the account. Required if multiple clients are available using the token.

Request parameters

The request contains the following required parameter:

  • id: ID of the cost center.

Request body

Data for the cost center is passed in the request body in JSON format:

Field

Description

Format

Required

name

The name of the cost center.

String

Yes

default

Indicates whether this cost center is used by default (set when the service is activated for the client).

Boolean

Yes

field_settings

The list of settings for each cost center field.

Array of objects

Yes

Structure of the field-settings array element:

Field

Description

Format

Required

id

Field ID (unique in the field set).

String

No

title

The name of the field.

Array of strings

Yes

required

Indicates whether this field must be filled in when the order is placed.

Boolean

Yes

hidden

Don't show or use this field when the order is placed.

Boolean

No

services

IDs of the services in which this field can be used when the order is placed. Acceptable values:

  • taxi: Yandex Go;

  • eats2: Yandex Eats and Yandex Grocery;

  • grocery: Yandex Grocery;

  • drive: Car sharing;

  • tanker: Yandex Fuel;

  • cargo: Cargo transportation;

  • travel: Yandex Travel;

  • scooters: Yandex Scooters.

String

Yes

format

Acceptable values:

  • select: The employee selects the cost center from the list.

  • text: The employee specifies the cost center on their own in the text field.

  • mixed: The employee can both select the cost center from the list and specify it in the text field.

String

Yes

values

The list of cost centers available to the employee.

Array of strings

Yes

Response field description

Responses may contain the following fields:

Field Description Format
id ID of the cost center. String

Request example

POST https://b2b-api.go.yandex.ru/integration/2.0/cost_centers/update?id=2983...3ecf
...
Authorization: Bearer <OAuth-token>
X-YaTaxi-Selected-Corp-Client-Id: <client-id>

  {
    "id": "87587...16e6b",
    "name": "Cost center to update",
    "default": false,
    "field_settings": [
      {
        "title": "Cost center",
        "required": true,
        "services": [
          "taxi",
          "eats2",
          "cargo"
        ],
        "format": "select",
        "values": [
          "Work",
          "Not work"
        ],
        "id": "cost_center",
        "hidden": true
      },
    ...,
      {
        "title": "Parameter123",
        "required": false,
        "services": [
          "taxi"
        ],
        "format": "text",
        "values": [],
        "id": "d9b2cf97-...-7dbfd2524699",
        "hidden": true
      }
    ]
  }

Response example

An example response to this request looks like this:

{
    "id": "2983...3ecf"
}

Response codes

The response to this request may contain the following standard HTTP codes:

  • 200: Request completed successfully.

  • 400: An unknown parameter or a parameter with an invalid value was passed in the request.

  • 403:

    • SELECT_CLIENT_HEADER_REQUIRED: the request did not pass the header X-YaTaxi-Selected-Corp-Client-Id (returned if more than one client is available for the token).

    • SELECTED_CLIENT_ACCESS_DENIED: the header X-YaTaxi-Selected-Corp-Client-Id contains the client's ID, which this login does not have access to.

  • 404: The requested record wasn't found.

  • 406: Updating the cost center with the passed parameters is not available.

  • 409: Conflict during cost center upgrade.

combined service

the service is outdated, use eats2

Hotels